Skip to content

[codex] Allow opt-in concurrent Codex runs#9

Draft
austinkennethtucker wants to merge 2 commits into
mainfrom
codex/fix-wrapper-busy-429
Draft

[codex] Allow opt-in concurrent Codex runs#9
austinkennethtucker wants to merge 2 commits into
mainfrom
codex/fix-wrapper-busy-429

Conversation

@austinkennethtucker

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in provider concurrency setting for local wrapper_busy 429s. The default remains one active Codex execution, but operators can set MAX_CONCURRENT_CODEX_RUNS=2 when the bottleneck is the wrapper admission gate rather than upstream rate limiting.

Why

The provider already had a short local queue, but bursty clients can still overlap requests and hit code: "wrapper_busy". A second local execution slot can absorb small overlaps without changing the default conservative single-user behavior.

Changes

  • Replaces the single execution lock with a bounded semaphore capped at two provider-side Codex runs.
  • Adds MAX_CONCURRENT_CODEX_RUNS env parsing, clamping, and .env.example docs.
  • Surfaces active/max run counts and queue wait settings in the dashboard status payload/UI.
  • Adds tests for setting clamps, dashboard admission metadata, two parallel requests, and 429 behavior when all slots are busy.

Validation

  • python3 scripts/check_repo_hygiene.py
  • python3 scripts/check_compose_security.py
  • COMPOSE_FILE=docker-compose.image.yml CODEX_CLI_PROVIDER_IMAGE=registry.example.com/your-org/codex-cli-provider:codex-cli-provider-0.1.2 python3 scripts/check_compose_security.py
  • PYTHONPATH=. .venv/bin/pytest -q

Comment thread tests/test_server.py

third = await request(app, "POST", "/v1/chat/completions", json=payload)
runner.release.set()
await first
Comment thread tests/test_server.py
third = await request(app, "POST", "/v1/chat/completions", json=payload)
runner.release.set()
await first
await second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant